package cn.swing.ushare.log.webapi.service;

import cn.swing.ushare.log.service.ILogService;
import cn.swing.ushare.log.webapi.mapper.LogMapper;
import cn.swing.ushare.pojo.dto.LogLimitSimpleDTO;
import cn.swing.ushare.pojo.dto.SearchLogDTO;
import cn.swing.ushare.pojo.vo.LogListVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class LogServiceImpl implements ILogService {

    @Autowired
    LogMapper logMapper;


    @Override
    public void insertOperationLog(String systemModule, String operationType, String operator, String operationDetail) {
        logMapper.insertOperationLog(systemModule, operationType, operator, operationDetail);
    }


    //@Override
    //public int deleteOperationLogById(Integer id) {
    //    return logMapper.deleteOperationLogById(id);
    //}

    @Override
    public List<LogListVO> logList(LogLimitSimpleDTO logLimitSimpleDTO) {
        List<LogListVO> logListVOS = logMapper.logList(logLimitSimpleDTO.getPage());
        System.out.println(logListVOS);
        return logListVOS;
    }

    @Override
    public Integer logCount(String operationType) {
        return logMapper.logCount(operationType);
    }

    @Override
    public List<LogListVO> searchLogList(SearchLogDTO searchLogDTO) {
        List<LogListVO> searchLogListVO = logMapper.searchLogList(searchLogDTO.getOperationType(), searchLogDTO.getPage());
        return searchLogListVO;
    }
}
